package com.zhuimeng.controller;

import com.zhuimeng.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Controller
public class HelloController {

    @Autowired
    ArticleService service;

    @RequestMapping("/")
    public String index(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "3") Integer pageSize, Model model){
        Map<String, Object> map = service.findAll(pageNum, pageSize);
        model.addAllAttributes(map);
        return "index";
    }
}
